package threelayer.service.impl;

import threelayer.bean.User;
import threelayer.dao.UserDao;
import threelayer.dao.impl.UserDaoImpl;
import threelayer.service.UserService;

/**
 * Created by Myth on 1/22/2017.
 */
public class UserServiceImpl implements UserService {
    //调用DAO层，可以改变实现方式
    private UserDao userDao = new UserDaoImpl();
    //private UserDao userDao = new UserDaoImpl2();
    //private UserDao userDao = new UserDaoImpl3();
    @Override
    public User login(String username, String password) {
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        //调用DAO查询
        return userDao.queryUser(user);
    }
}
